@extends('app')
@section('content')
<ul class="nav nav-tabs">
    <li><a href="{{ url('/admin/user')}}">用户列表</a></li>
    <li class="active"><a href="{{ url('/admin/users/user-add')}}">用户添加</a></li>
</ul>
<form id="userForm" method="post" action="">
    <div class="panel panel-default description2 mt20">
        <div class="form-group clearfix">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-left: 0;padding-right: 0;">用户名(密码默认cimers123)</label>
            <div class="col-sm-9 col-xs-12" style="padding-left: 0;padding-right: 0;">
                <input type="text" class="form-control" name="name" placeholder="用户名" value="@if(!empty($user)){{ $user->name }}@endif">
            </div>
        </div>
        <div class="form-group clearfix">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-left: 0;padding-right: 0;">系统角色:</label>
            <div class="col-sm-9 col-xs-12" style="padding-left: 0;padding-right: 0;">
                <label class="radio-inline">
                    <input type="radio" name="role_id"  value="0" @if(!empty($user)) @if($user->is_leader == 0) checked @endif @else checked @endif> 普通用户
                </label>
                <label class="radio-inline">
                    <input type="radio" name="role_id" value="2" @if(!empty($user)) @if($user->is_leader == 2) checked @endif @endif> 业绩管理员
                </label>
                <label class="radio-inline">
                    <input type="radio" name="role_id" value="3" @if(!empty($user)) @if($user->is_leader == 2) checked @endif @endif> 考勤管理员
                </label>
            </div>
        </div>
        <div class="form-group clearfix">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-left: 0;padding-right: 0;">用户角色:</label>
            <div class="col-sm-9 col-xs-12" style="padding-left: 0;padding-right: 0;">
                <label class="radio-inline">
                    <input type="radio" name="is_leader" value="0" @if(!empty($user)) @if($user->is_leader == 0) checked @endif @else checked @endif> 组员
                </label>
                <label class="radio-inline">
                    <input type="radio" name="is_leader"  value="1" @if(!empty($user)) @if($user->is_leader == 1) checked @endif  @endif> 组长
                </label>
            </div>
        </div>
        <div class="form-group clearfix">
            <label>选择分组：</label>
            <select name="group_id" class="form-control">
                @foreach($group as $g)
                    <option value="{{ $g->id }}" @if(!empty($user)) @if($g->id == $user->group_id) selected @endif @endif>{{ $g->name }}</option>
                @endforeach
            </select>
        </div>
        <div class="form-group clearfix">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-left: 0;padding-right: 0;">是否激活:</label>
            <div class="col-sm-9 col-xs-12" style="padding-left: 0;padding-right: 0;">
                 <label class="radio-inline">
                  <input type="radio" name="is_active"  value="0" @if(!empty($user)) @if($user->is_active == 0) checked @endif @else checked @endif> 是
                </label>
                <label class="radio-inline">
                  <input type="radio" name="is_active" value="1" @if(!empty($user)) @if($user->is_active == 1) checked @endif @endif> 否
                </label>
            </div>
        </div>
        {!! csrf_field() !!}
        <input type="hidden" name="userid" value="@if(!empty($user)){{ $user->id }}@endif">
        <div class="form-inline">
            <div class="form-group">
              <button type="button" class="btn btn-info" onclick="saveData('/admin/user/user-store','userForm')">
                    <i class="icon-ok bigger-110"></i>
                    Submit
              </button>  
            </div>
        </div>
    </div>
</form>
@endsection
